/*
 * Copyright (C) 2012, 2013, 2014, 2015 Apple Inc.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 */

/* You'll see a lot of !important rules in this file. This is because
   the inheritance and specificity of Shadow DOM trees is slightly
   tricky. The page might have accidentally set a style and we have
   to make sure it is reset. */

audio {
    min-width: 260px;
    height: 39px;
}

body:-webkit-full-page-media {
    background-color: rgb(38, 38, 38);
}

video:-webkit-full-page-media {
    margin: auto;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

video:-webkit-full-page-media::-webkit-media-controls-panel {
    bottom: 0px;
}

::-webkit-media-controls {
    width: inherit;
    height: inherit;
    position: relative;
    display: -webkit-flex !important;
    -webkit-align-items: stretch;
    -webkit-justify-content: flex-end;
    -webkit-flex-direction: column;
    font-family: -apple-system;
    overflow: hidden;
}

video::-webkit-media-controls-panel input[type="button"],
audio::-webkit-media-controls-panel input[type="button"],
video::-webkit-media-controls-panel button,
audio::-webkit-media-controls-panel button {
    padding: 0;
    border: none;
    -webkit-appearance: none;
}

video::-webkit-media-controls-inline-playback-placeholder,
audio::-webkit-media-controls-inline-playback-placeholder {
    display: block;
    z-index: 0;
    width: 100%;
    height: 100%;
    background-color: black;
    background-repeat: no-repeat;
    background-position: 50% 50%;
    background-size: 100% 50%;
}

video::-webkit-media-controls-inline-playback-placeholder.hidden,
audio::-webkit-media-controls-inline-playback-placeholder.hidden {
    display: none;
}

video::-webkit-media-text-track-container,
audio::-webkit-media-text-track-container {
    position: relative;
    -webkit-flex: 1 1 auto;
}

video::-webkit-media-controls-panel-container {
    -webkit-transform: translateZ(0);
    width: 100%;
    direction: ltr;
    height: 50px;
    position: absolute;
    bottom: 0;
    pointer-events: none;
}

audio::-webkit-media-controls-panel-container {
    width: 100%;
    direction: ltr;
    height: 39px;
    position: absolute;
    bottom: 0;
}

video::-webkit-media-controls-panel-background {
    -webkit-transform: translateZ(0);
    width: 101%; /* Due to some rounding issues we make this a little bit wider than should be necessary. */
    height: 51px; /* And taller. */
    -webkit-appearance: media-controls-light-bar-background;
    transition: opacity 0.25s linear;
    opacity: 0;
    pointer-events: none;
    bottom: 0;
    position: absolute;
}

audio::-webkit-media-controls-panel-background {
    display: none;
}

video::-webkit-media-controls-panel-background.show,
video::-webkit-media-controls-panel-background.paused {
    opacity: 1;
}

audio::-webkit-media-show-controls {
    display: none !important;
}
video::-webkit-media-show-controls {
    position: absolute;
    left: 0;
    bottom: 0;
    display: block;
    margin: 0;
    padding: 0;
    width: 100%;
    height: 10px;
    opacity: 0;
    border: 0;
    background: none;
    -webkit-appearance: none;
}

audio::-webkit-media-controls-panel,
video::-webkit-media-controls-panel {
    box-sizing: border-box;
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 0;

    -webkit-user-select: none;

    display: -webkit-flex;
    -webkit-flex-direction: row;
    -webkit-flex-wrap: nowrap;
    -webkit-justify-content: flex-start;
    -webkit-align-items: center;

    transition: opacity 0.25s linear;
    -webkit-transform-origin: bottom left;
}

video::-webkit-media-controls-panel .hidden,
audio::-webkit-media-controls-panel .hidden,
video::-webkit-media-controls-panel .dropped,
audio::-webkit-media-controls-panel .dropped {
    display: none;
}

video::-webkit-media-controls-panel {
    height: 50px;
    opacity: 0;
    pointer-events: none;
    -webkit-transform: translate3d(0, 0, 0);
}

audio::-webkit-media-controls-panel {
    height: 39px;
    background-color: rgba(212, 212, 212, 1);
}

video::-webkit-media-controls-panel.show,
video::-webkit-media-controls-panel.paused {
    pointer-events: auto;
    opacity: 1;
}

video::-webkit-media-controls-panel.picture-in-picture {
    pointer-events: none;
}

video::-webkit-media-controls-rewind-button,
audio::-webkit-media-controls-rewind-button,
video::-webkit-media-controls-panel .mute-box,
audio::-webkit-media-controls-panel .mute-box,
video::-webkit-media-controls-mute-button,
audio::-webkit-media-controls-mute-button,
video::-webkit-media-controls-volume-max-button,
video::-webkit-media-controls-panel .volume-box,
audio::-webkit-media-controls-panel .volume-box,
audio::-webkit-media-controls-volume-slider,
video::-webkit-media-controls-volume-slider {
    display: none !important;
}

video::-webkit-media-controls-start-playback-button {
    -webkit-appearance: none;
    position: absolute;
    width: 72px;
    height: 72px;
    left: calc(50% - 36px);
    top: calc(50% - 36px);
    -webkit-clip-path: circle(36px);
    -webkit-transform: translate3d(0, 0, 0);
}

video::-webkit-media-controls-start-playback-background {
    -webkit-appearance: none;
    position: absolute;
    width: 72px;
    height: 72px;
    background-color: rgba(255, 255, 255, 0.2);
    -webkit-backdrop-filter: blur(10px) saturate(200%);
}

video::-webkit-media-controls-start-playback-tint {
    -webkit-appearance: none;
    position: absolute;
    width: 72px;
    height: 72px;
    background-color: rgb(210, 210, 210);
    mix-blend-mode: darken;
}

video::-webkit-media-controls-start-playback-button .webkit-media-controls-start-playback-glyph {
    -webkit-appearance: none;
    position: absolute;
    width: 72px;
    height: 72px;
    opacity: 0.45;
    mix-blend-mode: plus-darker;
    background-image: url('');
    background-repeat: no-repeat;
    background-position: 50% 50%;
    background-size: 100% 100%;
}

video::-webkit-media-controls-start-playback-button .webkit-media-controls-start-playback-background.active {
    background-color: rgba(192, 192, 192, 0.2);
}

video::-webkit-media-controls-start-playback-button .webkit-media-controls-start-playback-glyph.failed {
    background-image: url('');
}

/* ================== ALL INLINE BUTTONS ====================== */

video::-webkit-media-controls-play-button,
audio::-webkit-media-controls-play-button,
video::-webkit-media-controls-fullscreen-button,
audio::-webkit-media-controls-fullscreen-button,
video::-webkit-media-controls-wireless-playback-picker-button,
audio::-webkit-media-controls-wireless-playback-picker-button,
video::-webkit-media-controls-picture-in-picture-button,
audio::-webkit-media-controls-picture-in-picture-button {
    -webkit-appearance: none;
    display: block;
    padding: 0;
    border: 0;
    -webkit-user-select: none;
    background-repeat: no-repeat;
    background-position: 50% 50%;
    mix-blend-mode: plus-darker;
    opacity: 0.55;
    -webkit-mask-position: 50% 50%;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-origin: border-box;
    background-color: black;
    transition: background-color 250ms;
}

video::-webkit-media-controls-play-button,
video::-webkit-media-controls-fullscreen-button,
video::-webkit-media-controls-wireless-playback-picker-button,
video::-webkit-media-controls-picture-in-picture-button {
    -webkit-transform: translate3d(0, 0, 0);
}

video::-webkit-media-controls-play-button:active,
audio::-webkit-media-controls-play-button:active,
video::-webkit-media-controls-fullscreen-button:active,
audio::-webkit-media-controls-fullscreen-button:active,
audio::-webkit-media-controls-wireless-playback-picker-button:active,
video::-webkit-media-controls-wireless-playback-picker-button:active,
video::-webkit-media-controls-picture-in-picture-button:active,
audio::-webkit-media-controls-picture-in-picture-button:active {
    mix-blend-mode: normal;
    opacity: 1;
    background-color: white;
    transition: background-color 0ms;
}

/* ================== PLAY BUTTON ====================== */

audio::-webkit-media-controls-play-button,
video::-webkit-media-controls-play-button {
    margin-left: 4px;
    -webkit-mask-image: url('');
    -webkit-mask-size: 18px 22px;
    -webkit-order: 1;
}

audio::-webkit-media-controls-play-button {
    width: 42px;
    height: 39px;
}

video::-webkit-media-controls-play-button {
    width: 44px;
    height: 50px;
}

audio::-webkit-media-controls-play-button.paused,
video::-webkit-media-controls-play-button.paused {
    -webkit-mask-image: url('');
    -webkit-mask-size: 21px 22px;
}

/* ================== FULLSCREEN BUTTON ====================== */

video::-webkit-media-controls-fullscreen-button {
    width: 44px;
    height: 50px;
    -webkit-mask-image: url('');
    -webkit-mask-size: 20px 20px;
    -webkit-order: 5;
}

/* ================== AIRPLAY BUTTON ====================== */

audio::-webkit-media-controls-wireless-playback-picker-button,
video::-webkit-media-controls-wireless-playback-picker-button {
    -webkit-mask-image: url('');
    -webkit-mask-size: 21px 18px;
    -webkit-order: 3;
}

audio::-webkit-media-controls-wireless-playback-picker-button {
    width: 44px;
    height: 39px;
}

video::-webkit-media-controls-wireless-playback-picker-button {
    width: 44px;
    height: 50px;
}

audio::-webkit-media-controls-wireless-playback-picker-button.playing,
video::-webkit-media-controls-wireless-playback-picker-button.playing {
    opacity: 1;
    mix-blend-mode: normal;
    background-color: -apple-wireless-playback-target-active;
}

/* ================== PICTURE IN PICTURE BUTTON ====================== */

video::-webkit-media-controls-picture-in-picture-button {
    width: 35px;
    height: 44px;
    -webkit-order: 5;
    -webkit-mask-size: 23px 18px;
    -webkit-mask-image: url('');
}

video::-webkit-media-controls-picture-in-picture-button.return-from-picture-in-picture {
    -webkit-mask-image: url('');
}

/* ================== SPACER ====================== */

video::-webkit-media-controls-spacer,
audio::-webkit-media-controls-spacer {
    -webkit-appearance: none !important;
    -webkit-flex: 1 1 0; /* Should be the same as the timeline container. */
    -webkit-order: 2;
    height: 8px;
    margin: 0;
    background-color: transparent !important;
}

/* ================== TIMELINE ====================== */

video::-webkit-media-controls-timeline,
audio::-webkit-media-controls-timeline {
    -webkit-appearance: none !important;
    -webkit-flex: 1 1 0;
    height: 8px;
    margin: 0;
    background-color: transparent !important;
    background-size: 100% 100%;
    border: none !important;
    border-radius: 0 !important;
    box-sizing: content-box !important;
}

video::-webkit-media-controls-timeline {
    -webkit-transform: translate3d(0, 0, 0);
    mix-blend-mode: plus-darker;
}

audio::-webkit-media-controls-timeline::-webkit-slider-runnable-track,
video::-webkit-media-controls-timeline::-webkit-slider-runnable-track {
    -webkit-appearance: none !important;
    background: none !important;
    border: none !important;
}

video::-webkit-media-controls-timeline::-webkit-slider-thumb,
audio::-webkit-media-controls-timeline::-webkit-slider-thumb {
    -webkit-appearance: none !important;
    width: 15px;
    height: 50px;
    background-image: url('');
    background-repeat: no-repeat;
    background-size: 15px 17px;
    background-position: 0px 18px;
    background-color: transparent !important;
    border: none !important;
    -webkit-transform: rotateZ(0deg);
}

video::-webkit-media-controls-timeline::-webkit-slider-thumb:active,
audio::-webkit-media-controls-timeline::-webkit-slider-thumb:active {
    background-color: transparent !important;
}

audio::-webkit-media-controls-timeline::-webkit-slider-thumb {
    height: 39px;
    background-position: 0px 12px;
}

video::-webkit-media-controls-current-time-display,
video::-webkit-media-controls-time-remaining-display,
audio::-webkit-media-controls-current-time-display,
audio::-webkit-media-controls-time-remaining-display {
    -webkit-user-select: none;
    -webkit-flex: 0 0 0;
    display: -webkit-flex;
    -webkit-align-items: center;
    overflow-y: hidden;
    overflow-x: hidden;
    letter-spacing: normal;
    word-spacing: normal;
    line-height: normal;
    text-transform: none;
    text-indent: 0px;
    text-decoration: none;
    color: black;
    mix-blend-mode: plus-darker;
    opacity: 0.55;
    height: 50px;
    font-size: 13px;
    font-family: -apple-system-monospaced-numbers;
}

audio::-webkit-media-controls-current-time-display,
video::-webkit-media-controls-current-time-display {
    min-width: 32px;
    -webkit-justify-content: flex-end;
    padding-right: 6px;
}

audio::-webkit-media-controls-time-remaining-display,
video::-webkit-media-controls-time-remaining-display {
    min-width: 38px;
    -webkit-justify-content: flex-start;
    padding-left: 6px;
    margin-right: 6px;
}

video::-webkit-media-controls-timeline-container,
audio::-webkit-media-controls-timeline-container {
    display: -webkit-flex;
    -webkit-flex-direction: row;
    -webkit-align-items: center;
    -webkit-user-select: none;
    -webkit-flex: 1 1 0; /* Any changes here should also be made on the spacer. */
    position: relative;
    padding: 0;
    -webkit-order: 2;
    -webkit-text-size-adjust: auto;
}

audio::-webkit-media-controls-timeline-container {
    padding-right: 10px;
}

audio::-webkit-media-controls-current-time-display.three-digit-time,
video::-webkit-media-controls-current-time-display.three-digit-time {
    min-width: 31px;
}

audio::-webkit-media-controls-time-remaining-display.three-digit-time,
video::-webkit-media-controls-time-remaining-display.three-digit-time {
    min-width: 40px;
}

audio::-webkit-media-controls-current-time-display.four-digit-time,
video::-webkit-media-controls-current-time-display.four-digit-time {
    min-width: 40px;
}

audio::-webkit-media-controls-time-remaining-display.four-digit-time,
video::-webkit-media-controls-time-remaining-display.four-digit-time {
    min-width: 49px;
}

audio::-webkit-media-controls-current-time-display.five-digit-time,
video::-webkit-media-controls-current-time-display.five-digit-time {
    min-width: 51px;
}

audio::-webkit-media-controls-time-remaining-display.five-digit-time,
video::-webkit-media-controls-time-remaining-display.five-digit-time {
    min-width: 60px;
}

audio::-webkit-media-controls-current-time-display.six-digit-time,
video::-webkit-media-controls-current-time-display.six-digit-time {
    min-width: 60px;
}

audio::-webkit-media-controls-time-remaining-display.six-digit-time,
video::-webkit-media-controls-time-remaining-display.six-digit-time {
    min-width: 69px;
}

/* ================== STATUS DISPLAY ====================== */

video::-webkit-media-controls-status-display,
audio::-webkit-media-controls-status-display {

    overflow: hidden;
    font-family: -apple-system;
    letter-spacing: normal;
    word-spacing: normal;
    line-height: normal;
    text-transform: none;
    text-indent: 0px;
    text-decoration: none;
    color: black;
    mix-blend-mode: plus-darker;
    opacity: 0.55;
    -webkit-order: 2;
}

/* ================== CAPTIONS ====================== */

video::-webkit-media-text-track-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding-bottom: 5px;
    z-index: 0;

    text-align: center;
    color: rgba(255, 255, 255, 1);

    letter-spacing: normal;
    word-spacing: normal;
    text-transform: none;
    text-indent: 0;
    text-decoration: none;
    pointer-events: none;
    -webkit-user-select: none;
    word-break: break-word;

    -webkit-flex: 1 1;

    -webkit-line-box-contain: block inline-box replaced;
}

video::cue {
    background-color: rgba(0, 0, 0, 0.8);
}

video::-webkit-media-text-track-display {
    position: absolute;
    overflow: hidden;
    white-space: pre-wrap;
    -webkit-box-sizing: border-box;
    font: 22px sans-serif;
}

video::-webkit-media-text-track-display-backdrop {
    display: inline-block;
}

video::cue(:future) {
    color: gray;
}

video::-webkit-media-text-track-container b {
    font-weight: bold;
}

video::-webkit-media-text-track-container u {
    text-decoration: underline;
}

video::-webkit-media-text-track-container i {
    font-style: italic;
}

/* ==================== PLAYBACK PLACARD ==================== */

video::-webkit-media-controls-wireless-playback-status,
audio::-webkit-media-controls-wireless-playback-status {
    display: block;
    position: absolute;
    left: 0px;
    top: 0px;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 131 90"><g fill="none" stroke="-apple-system-gray" stroke-width="4"><rect x="2" y="2" width="127" height="76"/><line x1="30" y1="88" x2="101" y2="88"/></g></svg>');
    background-color: rgb(51, 51, 53);
    background-repeat: no-repeat;
    background-position: 50% calc(.5 * (100% - 25px) - 21pt);
    background-size: 131px auto;
    color: -apple-system-gray;
    font: -apple-system;
    font-weight: 400;
    vertical-align: text-bottom;
}

video::-webkit-media-controls-wireless-playback-text,
audio::-webkit-media-controls-wireless-playback-text {
    cursor: default;
    position: absolute;
    width: 100%;
    top: calc(.5 * (100% - 25px) + (.5 * (90px + 42pt) - 42pt));
    -webkit-user-select: none;
    margin: 0px;
    height: 42pt;
}

video::-webkit-media-controls-wireless-playback-text-top,
audio::-webkit-media-controls-wireless-playback-text-top {
    position: absolute;
    top: 15pt;
    width: 100%;
    line-height: 12pt;
    height: 12pt;
    font-size: 12pt;
    text-align: center;
    margin: 0px;
    color: -apple-system-gray;
}

video::-webkit-media-controls-wireless-playback-text-bottom,
audio::-webkit-media-controls-wireless-playback-text-bottom {
    position: absolute;
    bottom: 0;
    left: 5%;
    width: 90%;
    line-height: 10pt;
    height: 10pt;
    font-size: 10pt;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0px;
}

video::-webkit-media-controls-wireless-playback-status.small,
audio::-webkit-media-controls-wireless-playback-status.small {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 62 43"><g fill="none" stroke="rgb(146,146,146)" stroke-width="2"><rect x="1" y="1" width="60" height="36"/><line x1="14" y1="42" x2="48" y2="42"/></g></svg>');
    background-position: 50% calc(.5 * (100% - 25px) - 5pt);
    background-size: 62px auto;
}

video::-webkit-media-controls-wireless-playback-text-top.small,
audio::-webkit-media-controls-wireless-playback-text-top.small {
    top: 4pt;
}

video::-webkit-media-controls-wireless-playback-text-bottom.small,
audio::-webkit-media-controls-wireless-playback-text-bottom.small {
    display: none;
}

video::-webkit-media-controls-wireless-playback-status.picture-in-picture,
audio::-webkit-media-controls-wireless-playback-status.picture-in-picture
{
    background-size: 304px auto;
    background-position: 50% calc(.5 * (100% - 25px));
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 304 150"><g fill="none" stroke="-apple-system-gray" stroke-width="3"><path d="m 172,106 -81,0 c -3.5,0 -6,-2.5 -6,-6 l 0,-89 c 0,-3.5 2.5,-6 6,-6 l 122,0 c 3.5,0 6,2.5 6,6 l 0,57" /><path d="m 233,119 -53,0 c -3,0 -3,-0 -3,-3 l 0,-40 c 0,-3 0,-3 3,-3 l 53,0 c 3,0 3,0 3,3 l 0,40 c 0,3 0,3 -3,3 z" /></g></svg>');
}

video::-webkit-media-controls-wireless-playback-text-top.picture-in-picture,
audio::-webkit-media-controls-wireless-playback-text-top.picture-in-picture {
    top: initial;
    bottom: 0;
}

video::-webkit-media-controls-wireless-playback-text-bottom.picture-in-picture,
audio::-webkit-media-controls-wireless-playback-text-bottom.picture-in-picture {
    display: none;
}

video::-webkit-media-controls-wireless-playback-status.hidden,
audio::-webkit-media-controls-wireless-playback-status.hidden {
    display: none;
}

/* When PiP is active, we don't want the controls container showing. */
video::-webkit-media-controls-panel-container.picture-in-picture {
    opacity: 0;
    pointer-events: none;
}

